<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新闻</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.1/css/swiper.min.css">
    <link rel="stylesheet" th:href="@{css/me.css}">
    <link rel="stylesheet" th:href="@{css/animate.compat.css}">
    <link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.css">

    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    <style>
        .swiper-container {
            width: 100%;
            height: 300px;
            margin-left: 30px;
        }

        .swiper-slide {
            width: 100%;
            height: 200px;
            position: relative;
        }

        .swiper-slide img {
            width: 100%;
            height: 100%;
        }

        .swiper-slide .swiper-text {
            width: 100%;
            position: absolute;
            bottom: 0;
            left: 0;
            padding: 5px 0;
            background-color: rgba(0, 0, 0, 0.1);
            color: #fff;
        }

        /* CSS表明阐明：这里对CSS代码换行是为了让代码在此我要中透露表现残破，换行后CSS成效不受影响 */

    </style>
</head>
<body>
<!-- 导航 -->
<nav th:replace="_fragments :: menu(1)"
     class=" ui secondary attached m-opacity-mid segment m-mini m-shadow animated fadeInDown">
</nav>
<!-- 中间内容 -->
<main class="m-large m-container animated fadeInUpBig ">
    <div class="ui container">
        <div class="ui grid  stackable">
            <!-- 左边布局 -->
            <div class="eleven wide column">
                <!--轮播图-->
                <div class="swiper-container" style="width: 750px; height: 370px;">
                    <div class="swiper-wrapper">
                        <div class="swiper-slide" style="position: relative;" th:each="images:${imagespage.records}">
                            <a th:href="${images.url}" target="_blank">
                                <!--                                    <img th:src="${images.imageurl}" alt="" >-->
                                <img style="display: inline-block; width: 100%; max-width: 100%; height: 100%;"
                                     th:src="${images.imageurl}"/>
                            </a>
                            <div class="swiper-text"
                                 style="width: 100%;
                                 position: absolute;
                                 bottom: 0;
                                left: 0;
                                padding: 10px 0;
                                background-color: rgba(0, 0, 0, 0.3);
                                padding-left:10px;
                                font-size:20px;
                                color: #fff;"
                                 th:text="${images.name}"></div>
                        </div>
                    </div>
                    <!-- 如果需要分页器 -->
<!--                    <div class="swiper-pagination"></div>-->
                    <!-- 如果需要导航按钮 -->
                    <div class="swiper-button-prev"></div>
                    <div class="swiper-button-next"></div>
                    <!-- 如果需要滚动条 -->
                    <div class="swiper-scrollbar"></div>
                </div>
                <!--轮播图结束-->
                <!-- 头部 -->
                <div class="ui  top attached segment">
                    <div class="ui middle aligned two column stackable grid">
                        <div class="column">
                            <h2 class="ui blue header">最新新闻</h2>
                        </div>
                        <div class="right aligned column ">
                            共 <h2 class="ui red header m-inline-block" th:text="${page.total}"></h2>篇
                        </div>
                    </div>
                </div>

                <!-- 内容 -->

                <div class="ui attached m-container segment ">
                    <div class="ui padded vertical m-large segment" th:each="news : ${page.records}">
                        <div class="ui mobile reversed grid">
                            <div class=" eleven wide column">
                                <h3 class="ui header">
                                    <a href="" class="m-black" th:href="@{/news/{id}(id=${news.id})}"
                                       th:text="${news.title}" target="_blank"></a>
                                </h3>
                                <p class="m-line" th:text="|${news.description}.....|"></p>
                                <div class="ui grid">
                                    <div class="eleven wide column ">
                                        <div class="ui mini horizontal link list ">
                                            <div class="item">
                                                <img src="/static/images/cg1.png" alt=""
                                                     th:src="@{${news.user.avatarpc}}"
                                                     class="ui avatar image img-tiny">
                                                <div class="content">
                                                    <a href="" class=" header" th:text="${news.user.nickName}">可乐</a>
                                                </div>
                                            </div>
                                            <div class="item ">
                                                <i class="calendar icon"></i><span
                                                    th:text="${#dates.format(news.updateTime,'yyyy-MM-dd')}">2020-8-9</span>
                                            </div>
                                            <div class="item">
                                                <i class="eye icon"></i> &nbsp;<span th:text="${news.views}"></span>
                                            </div>

                                        </div>


                                    </div>
                                    <div class="right aligned five wide column">
                                        <a href="" target="_blank" class="ui label basic red"
                                           th:text="${news.typename}">热点新闻</a>
                                    </div>
                                </div>

                            </div>
                            <div class="five wide column">
                                <a href="" th:href="@{/news/{id}(id=${news.id})}" target="_blank">
                                    <img src="../static/images/cg1.png" alt="" th:src="@{${news.firstPicture}}"
                                         class="ui rounded image img-style">
                                </a>
                            </div>
                        </div>
                    </div>

                </div>


                <div class="ui bottom attached segment">
                    <div class="ui middle aligned two column grid" th:if="${page.total}>1">
                        <div class="column">
                            <a href="" th:href="@{/(current=${page.current}-1)}" th:if="${hasPrevious}"
                               class=" ui teal button">上一页</a>
                        </div>
                        <div class="right aligned column ">
                            <a href="" th:href="@{/(current=${page.current}+1)}" th:if="${hasNext}"
                               class=" ui teal button">下一页</a>
                        </div>
                    </div>
                </div>

            </div>


            <!-- 右边布局top -->
            <div class="five wide column">
                <!--热点新闻TOP10-->
                <div class="ui  segments">
                    <div class="ui secondary segment">
                        <div class="ui two column grid">
                            <div class="column" style="font-weight: bold;font-size:16px; width:100%;">
                                <i class="thumbtack icon"></i>热点新闻TOP10
                            </div>
                            <!--                            <div class="right aligned column">-->
                            <!--                            </div>-->
                        </div>
                    </div>
                    <div class="ui blue ">
                        <div class="ui fluid vertical menu">
                            <div th:each="news : ${newsrecommend}" class="item" style="font-size:15px;">
                                <span th:text="${news.cont}+'&nbsp;&nbsp'"></span>
                                <a href="" target="_blank" style="color: #666666" th:href="@{/news/{id}(id=${news.id})}"
                                   th:text="${news.title}"></a>
                            </div>
                            <!--                            <a href="" target="_blank" th:href="@{/news/{id}(id=${news.id})}" th:each="news : ${newsrecommend}" class="item"-->
                            <!--                               th:text="${news.title}"></a>-->
                        </div>
                    </div>
                </div>
                <!--视频TOP-->
                <div class="ui  segments">
                    <div class="ui secondary segment">
                        <div class="ui two column grid">
                            <div class="column" style="font-weight: bold;font-size:16px; width:100%;">
                                <i class="idea icon"></i>公益视频
                            </div>
                            <!--                            <div class="right aligned column">-->
                            <!--                            </div>-->
                        </div>
                    </div>
                    <div class="ui blue ">
                        <div class="ui fluid vertical menu">
                            <div th:each="video : ${videopage.records}" class="item" style="font-size:15px;">
                                <span th:text="${video.cont}+'&nbsp;&nbsp'"></span>
                                <a href="" target="_blank" style="color: #666666"
                                   th:href="@{/video/details/{id}(id=${video.id})}"
                                   th:text="${video.title}"></a>
                            </div>
                            <!--                            <a href="" target="_blank" th:href="@{/news/{id}(id=${news.id})}" th:each="news : ${newsrecommend}" class="item"-->
                            <!--                               th:text="${news.title}"></a>-->
                        </div>
                    </div>
                </div>
                <!--                禁毒百科-->
                <!--轮播图-->
                <div style="height: 30px; width: 100%;">
                    <div style="font-weight: bold;font-size:18px; color: #666666; top: 50%; margin:auto;left:50%;">
                        &nbsp;&nbsp;禁毒百科
                    </div>
                </div>

                <div class="swiper-container" style="width: 100%; height: 250px;">
                    <div class="swiper-wrapper">
                        <div class="swiper-slide"
                             style="position: relative;"
                             th:each="images:${wikipage.records}">
                            <a th:href="${images.url}" target="_blank">
                                <!--<img th:src="${images.imageurl}" alt="" >-->
                                <img style="display: inline-block; width: 100%; max-width: 100%; height: 100%;"
                                     th:src="${images.imageurl}"/>
                            </a>
                            <div class="swiper-text"
                                 style="width: 100%;
                                 position: absolute;
                                 bottom: 0;
                                left: 0px;
                                padding: 5px 0;
                                padding-left:10px;
                                background-color: rgba(0, 0, 0, 0.4);
                                color: #fff;"
                                 th:text="${images.name}"></div>
                        </div>
                    </div>
                    <!-- 如果需要分页器 -->
                    <!--                    <div class="swiper-pagination"></div>-->
                    <!-- 如果需要导航按钮 -->
                    <div class="swiper-button-prev"></div>
                    <div class="swiper-button-next"></div>
                    <!-- 如果需要滚动条 -->
                    <div class="swiper-scrollbar"></div>
                </div>
                <!--轮播图结束-->


            </div>

        </div>

    </div>


</main>


<!-- 底部 -->
<footer th:replace="_fragments :: footer" class="ui secondary m-opacity-mid vertical segment m-massive m-shadow">

</footer>

<th:block th:replace="_fragments :: script">
    <script src="https://unpkg.com/swiper/swiper-bundle.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.1/js/swiper.min.js"></script>
    <script src="../static/js/jquery-3.4.1.min.js"></script>
</th:block>
<script>
    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');

    });

    window.onload = function () {
        var mySwiper = new Swiper('.swiper-container', {
            // 轮播图的方向，也可以是vertical方向
            direction: 'horizontal',

            //播放速度
            loop: true,

            // 自动播放时间
            autoplay: 1000,

            // 播放的速度
            speed: 2000,

            // 如果需要分页器，即下面的小圆点
            pagination: '.swiper-pagination',

            // 如果需要前进后退按钮
            nextButton: '.swiper-button-next',
            prevButton: '.swiper-button-prev',　　　　　　　　　　　// 这样，即使我们滑动之后， 定时器也不会被清除　　　　  autoplayDisableOnInteraction : false,

            // 如果需要滚动条
            scrollbar: '.swiper-scrollbar',
        });
    }
</script>


</body>
</html>